package com.cjg.xiancheng;

public class threadDaemon {
    public static void main(String[] args) {
        me me = new me();
        parents parents = new parents();


        new Thread(()->{
            System.out.println("双方都是风景");
        });

        //设置守护线程

        Thread thread = new Thread(me);
        thread.setDaemon(true);
        thread.start();
        new Thread(parents).start();
    }
}
class me implements Runnable{
    @Override
    public void run() {
        while (true){
            System.out.println("我守护着你");
        }

    }
}
class parents implements Runnable{

    @Override
    public void run() {
        for (int i = 0; i <= 36500; i++) {
            System.out.println("爸妈开心的活了"+i);
        }
        System.out.println("happy end");
    }
}